<!--
 * @Author: 137 '1432417996@qq.com'
 * @Date: 2025-05-15 00:43:05
 * @LastEditors: 137 '1432417996@qq.com'
 * @LastEditTime: 2025-05-15 21:30:55
 * @FilePath: \starter-3\components\homepage\bulletinBox.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div class="bulletin">
        <div class="bulletin-title">
            <div class="title-text1">
                <span class="black-text">出海</span>
                <span class="blue-text">头条</span>
            </div>
            <div class="title-icon1"></div>
            <div class="title-more" @click="goNewsList">更多</div>
        </div>
        <ul>
            <li v-for="(item, index) in newsHeadlines" :key="index" @click="goNewsDetail(item.id)">{{ item.title }}</li>
        </ul>
    </div>
</template>

<script setup>
import { getNewsHeadlines } from "@/api/information";

onMounted(() => {
  // getNewsHeadlinesFun();
})

const goNewsList = () => {
  window.open(`/information/informationList`, "_blank");
}

const newsHeadlines = ref([]);

const getNewsHeadlinesFun = () => {
  getNewsHeadlines({ limit: 5 }).then(res => {
    newsHeadlines.value = res.data;
  })
}

const getNewsHeadlinesFunSSR = async () => {
  const getNewsHeadlinesData = await getApi('/news/p/headlines', { params: { limit: 5 } });
  newsHeadlines.value = getNewsHeadlinesData.data;
}


const goNewsDetail = (id) => {
  window.open(`/information/informationDetails?id=${id}`, "_blank");
}

getNewsHeadlinesFunSSR();

</script>

<style scoped></style>